unit UnlDrops;

interface

uses
  SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms, Dialogs,
  BCPort;

const
  MaxUnlDataSize = 1024;

var
  Responce : array[0..MaxUnlDataSize-1] of Byte;
  Count : Integer;

procedure CopyResponce(Data : PByte; CountData : Integer);
function CompareResponce(Data : PByte; CountData : Integer): Boolean;

implementation

procedure CopyResponce(Data : PByte; CountData : Integer);
var
  p : ^Byte;
  i : Integer;
begin
  Count := CountData;
  p := Pointer(Data);
  for i := 0 to Count - 1 do begin
    Responce[i] := p^;
    Inc(p);
  end;
end;

function CompareResponce(Data : PByte; CountData : Integer): Boolean;
var
  p : ^Byte;
  i : Integer;
begin
  Result := True;
  p := Pointer(Data);
  if Count <> CountData then Result := False;
  for i := 0 to CountData - 1  do
    if Responce[i] <> p^ then begin
      Result := False;
      Break;
    end;
  if Result = False then
    while i < CountData do begin
      Responce[i] := p^;
      inc(p);
      inc(i);
    end;
  Count := CountData;
end;

end.
